package com.b.domain;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
    * 订单表
    */
@Document(indexName = "order")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Order implements Serializable {
    @Serial
    private static final long serialVersionUID = -8108809732258815052L;
    /**
    * 订单ID
    */
    @Id
    @Field(type = FieldType.Text, index = true , store = true)
    private String id;

    /**
    * 用户ID
    */
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer userId;

    /**
    * 商品ID
    */
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer productId;

    /**
    * 金额
    */
    @Field(type = FieldType.Double, index = false , store = true)
    private BigDecimal amount;

    /**
    * 地址ID
    */
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer addressId;

    /**
    * 状态（待支付/待发货/已发货/已完成/已取消）
    */
    @Field(type = FieldType.Text, index = true , store = true)
    private String status;

    /**
    * 下单时间
    */
    @Field(type = FieldType.Date, index = false , store = true)
    private Date orderTime;


    private Address address;
}